<template>
    <div>
        <!-- 检票结算 -->
        <!-- nav栏 -->
        <el-row>
            <el-col :span="18">
                <ul class="fun-ul">
                    <li @click="toPrint">打单</li>
                    <li class="tag">|</li>
                    <li @click="toSendClass">报班</li>
                    <li class="tag">|</li>
                    <li @click="toCheck">查询</li>
                    <li class="tag">|</li>
                    <li @click="toNormalCheck">正常检票</li>
                    <li class="tag">|</li>
                    <li @click="toSign">补签</li>
                    <li class="tag">|</li>
                    <li @click="toAban">废检</li>
                    <li class="tag">|</li>
                    <li>全签</li>
                    <li class="tag">|</li>
                    <li>特检</li>
                    <li class="tag">|</li>
                    <li @click="toAllAban">全废检</li>
                    <li class="tag">|</li>
                    <li @click="toTickCheck">票证审核</li>
                </ul>
            </el-col>
        </el-row>
        <!-- 表单栏 -->
        <el-row class="form-container">
            <el-col :span="2">
                <img src="../../assets/imgs/check_bg_jianpiap_default.png" alt="" class="form-img">
                <div class="form-text">正常检票</div>
            </el-col>
            <el-col :span="15">
                <avue-form v-model="checkForm" :option="checkOption" class="check-form"></avue-form>
            </el-col>
            <el-col :span="7" class="form-table">
                <el-tabs v-model="formActive" @tab-click="handleLoadClick">
                    <el-tab-pane label="正在验票" name="first">
                        <span slot="label"><img src="../../assets/imgs/check_icon_jianpiao_selected.png" alt=""> 正在检票</span>
                        <TableData :data="formTable[0].data" :option="formTable[0].option" :rowChange="rowChange" class="right-table"></TableData>
                        <div id="appendIng"></div>
                    </el-tab-pane>
                    <el-tab-pane label="已发发班次" name="second">
                        <span slot="label"><img src="../../assets/imgs/check_icon_banci_selected.png" alt=""> 已发班班次</span>
                        <TableData :data="formTable[0].data" :option="formTable[0].option" :rowChange="rowChange" class="right-table"></TableData>
                        <div id="appendHas"></div>
                    </el-tab-pane>
                </el-tabs>
                <i class="load-icon" v-if="loadT" @click="loadIcon1"></i>
                <i class="load-icon" v-if="loadF" @click="loadIcon2"></i>
            </el-col>
        </el-row>
        <!-- 数据栏 -->
        <el-row class="data-container">
            <!-- 座位栏 -->
            <el-col :span="24" class="table-fun">
                <ul class="seat-ul">
                    <li class="seat-text">座位表</li>
                    <li class="color-tag"></li>
                    <li class="seat-text">未售</li>
                    <li class="color-tag" style="background:#009688"></li>
                    <li class="seat-text">售出</li>
                    <li class="color-tag" style="background:#2F88F4"></li>
                    <li class="seat-text">已验</li>
                    <li class="color-tag" style="background:#F7554D"></li>
                    <li class="seat-text">停售</li>
                    <li class="color-tag" style="background:#A1E18B"></li>
                    <li class="seat-text">留位</li>
                    <li class="seat-fun">
                        <img src="../../assets/imgs/operation_icon_dayin_default.png" alt="" class="lf">
                        <div class="lf choose-title">打印空白座位表</div>
                    </li>
                </ul>

            </el-col>
        </el-row>
        <!-- 弹窗 -->
        <div class="modal-win" v-show="modalShow">
            <!-- 标题 -->
            <el-row>
                <el-col :span="24">
                    <img src="../../assets/imgs/operation_bg_biaoti_default.png" alt="" class="lf modal-img">
                    <div class="lf modal-title">{{modalTitle}}</div>
                    <div class="rf close" @click="closeModual">X</div>
                </el-col>
            </el-row>
            <!-- 信息栏 -->
            <!-- 班次发班（打单） -->
            <div v-show="modalTitle=='班次发班'">
                <el-row clsas="print-form-container">
                    <el-col :span="24">
                        <avue-form v-model="printForm" :option="printOption" class="print-form"></avue-form>
                        <div style="height:60px;">
                            <div class="choose-title state-text">状态</div>
                            <img src="../../assets/imgs/check_bg_jianpiao_default.png" alt="" class="state-img">
                            <!--<div class="img-text">报&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;班</div>-->
                            <div class="img-text" style="letter-spacing:36px;text-align: center">发班</div>
                            <button style="right:27%;background:#009688;color:#fff;width:60px;" class="check-btn print-btn" @click="searchBtn">查询</button>
                            <button class="check-btn print-btn" @click="unPrint">发班不打单</button>
                            <button class="check-btn print-btnII" @click="printTic">打&nbsp;&nbsp;&nbsp;单</button>
                        </div>
                    </el-col>
                </el-row>
                <el-row>
                    <el-col :span="24" >
                        <div class="hasSeal" v-if="hasSe">
                            <ul class="print-box lf">
                                <!--<li>
                                    <span class="print-txt">发班单号：</span>
                                    <span>99918250006</span>
                                </li>
                                <li>
                                    <span>操作员：</span>
                                    <span>99918250006</span>
                                </li>
                                <li>
                                    <span>发班时间：</span>
                                    <span>99918250006</span>
                                </li>
                                <li>
                                    <span>检票人数：</span>
                                    <span>99918250006</span>
                                </li>
                                <li>
                                    <span>携童：</span>
                                    <span>99918250006</span>
                                </li>
                                <li>
                                    <span>票款合计：</span>
                                    <span>99918250006</span>
                                </li>
                                <li>
                                    <span>状态：</span>
                                    <span>99918250006</span>
                                </li>
                                <li>
                                    <span>已结算：</span>
                                    <span>99918250006</span>
                                </li>-->
                            </ul>
                            <div class="sealScrap rf">
                                <div class="sealScrap-btn lf">
                                    <button><i></i>打印</button>
                                    <button><i class="feidan-icon"></i>废单</button>
                                </div>
                                <div class="hasDaDan rf">已打单</div>
                            </div>
                        </div>

                        <div class="no-seal" v-show="noSeal">
                            <div class="no-sealAvue lf">
                                <avue-crud v-model="printTables" :data="printTable.data" :option="printTable.option" :rowChange="rowChange"
                                           class="send-table" ></avue-crud>
                                <div style="position: absolute;top: 81%;left: 50%;transform: translate(-50%,-50%);">班次[{{this.printForm.bus_id}}]未有售票记录</div>
                            </div>
                            <div class="no-seaWei rf">未打单</div>
                        </div>

                    </el-col>
                </el-row>
            </div>
            <!-- 班次报班（报班） -->
            <div v-show="modalTitle=='班次报班'">
                <el-row>
                    <el-col :span="24">
                        <avue-form v-model="sendClassForm" :option="sendClassFormOption" class="sendClassFrom"></avue-form>
                        <button class="check-btn send-btn"><img
                                src="../../assets/imgs/operation_btn_icon_chongzhi_default.png" alt="" class="btn-img"
                                @click="reset">重置
                        </button>
                        <button class="check-btn send-btnII" @click="sendClass"><img
                                src="../../assets/imgs/operation_btn_icon_bianji_default.png" alt="" class="btn-img">报班
                        </button>
                    </el-col>
                </el-row>
                <el-row>
                    <el-col :span="24">
                        <avue-crud v-model="sendClassTable.data" :option="sendClassTable.option" @current-row-change="rowChange"
                                   class="class-table"></avue-crud>
                    </el-col>
                </el-row>

            </div>
            <!-- 个人打单记录（查询） -->
            <div v-show="modalTitle=='个人打单记录'">
                <avue-form v-model="printChecForm" :option="printChecFormOption" class="printForm"></avue-form>
                <button class="check-btn send-btnII" @click="selfBtn" style="position: absolute;top: 13%;right: 25%;"><img
                        src="../../assets/imgs/operation_btn_icon_tijiao_default.png" alt="" class="btn-img">查询
                </button>
                <button class="check-btn send-btnII" @click="selfShua" style="position: absolute;top: 13%;right: 10%;"><img
                        src="../../assets/imgs/operation_icon_shuaxin_default.png" alt="" class="btn-img">刷新
                </button>
                <avue-crud :data="pPrintData" :option="pPrintTable" class="print-table"></avue-crud>
            </div>
        </div>
        <!-- 票证核验弹窗 -->
        <div class="tic-check-win" v-show="modalTitle=='票证核验'">
            <!-- 标题 -->
            <el-row>
                <el-col :span="24">
                    <img src="../../assets/imgs/operation_bg_biaoti_default.png" alt="" class="lf modal-img">
                    <div class="lf modal-title">{{modalTitle}}</div>
                    <div class="rf close" @click="closeTicModual">X</div>
                </el-col>
            </el-row>
            <!-- 信息栏 -->
            <el-row>
                <el-col :span="24">
                    <div class="car-msg">车票信息</div>
                </el-col>
            </el-row>
            <el-row>
                <el-col :span="15" class="checked-car-form">
                    <FormData :ob="checkedForm" :op="checkedOption" class="checked-form"></FormData>
                </el-col>
                <el-col :span="9" class="checkedID-container">
                    <el-tabs v-model="checkedActive" type="card" @tab-click="handleClick">
                        <el-tab-pane label="身份证" name="first">
                            <FormData :ob="checkedOther" :op="checkedOtherOption" class="checkedID-form"></FormData>
                            <button class="check-btn rf checked-btn2"><img
                                    src="../../assets/imgs/operation_btn_icon_tijiao_default.png" alt=""
                                    class="btn-img">确认审核
                            </button>
                            <button class="check-btn rf checked-btn2"><img
                                    src="../../assets/imgs/operation_btn_icon_shousuo_default.png" alt=""
                                    class="btn-img">读取身份证信息
                            </button>
                        </el-tab-pane>
                        <el-tab-pane label="其他证件" name="second">
                            <FormData :ob="checkedID" :op="checkedIdOption" class="checkedID-form"></FormData>
                            <button class="check-btn rf checked-btn"><img
                                    src="../../assets/imgs/operation_btn_icon_tijiao_default.png" alt=""
                                    class="btn-img">确认审核
                            </button>
                            <button class="check-btn rf checked-btn"><img
                                    src="../../assets/imgs/operation_btn_icon_shousuo_default.png" alt=""
                                    class="btn-img">读取身份证信息
                            </button>
                        </el-tab-pane>
                    </el-tabs>
                </el-col>
            </el-row>
            <el-row>
                <el-col :span="15" class="checkedDownTable-container">
                    <TableData :data="checkedDownTable.data" :option="checkedDownTable.option"></TableData>
                </el-col>
                <el-col :span="9" class="pic-take">
                    <div class="tag-container">图像采集</div>
                    <button class="check-btn pic-btn"><img
                            src="../../assets/imgs/operation_btn_icon_shousuo_default.png" alt="" class="btn-img">读取身份证信息
                    </button>
                </el-col>

            </el-row>

        </div>
    </div>
</template>

<script>
    import FormData from "../../components/common/form";
    import TableData from "../../components/common/tableData";

    const DIC = {
        SEX: [
            {
                label: "男",
                value: 0
            },
            {
                label: "女",
                value: 1
            }
        ],
        MingZu: [],
        credentialType:[],
        printArr:['发班单号：','操作员：','发班时间：','检票人数：','携童：','票款合计：','状态：'],
        printStr:[],

    };
    export default {
        data: function () {
            return {
                hasSe:true,
                noSeal:false,
                newDate:'',
                printNewArr:[],
                classData:[],
                pPrintData:[],
                loadT:true,
                loadF:false,
                checkDate:'',
                formActive: "first",
                checkForm: {},
                printTables: {},
                checkOption: {
                    column: [
                        {
                            label: "日期",
                            prop: "date",
                            type: "date",
                            span: 6
                        },
                        {
                            label: "条码",
                            prop: "ID",
                            span: 7
                        },
                        {
                            label: "检票口",
                            prop: "checkDoor",
                            span: 5
                        },
                        {
                            disabled: true,
                            label: "准备共售",
                            prop: "readySell",
                            span: 5
                        },
                        {
                            disabled: true,
                            label: "线路",
                            prop: "road",
                            span: 6
                        },
                        {
                            disabled: true,
                            label: "报班车牌",
                            prop: "carID",
                            span: 7
                        },
                        {
                            disabled: true,
                            label: "检票口位",
                            prop: "checkID",
                            span: 5
                        },
                        {
                            disabled: true,
                            label: "已售免童",
                            prop: "freeChild",
                            span: 5
                        },
                        {
                            disabled: true,
                            label: "班次",
                            prop: "classID",
                            span: 6
                        },
                        {
                            disabled: true,
                            label: "时间",
                            prop: "time",
                            span: 7
                        },
                        {
                            disabled: true,
                            label: "状态",
                            prop: "state",
                            span: 5
                        },
                        {
                            disabled: true,
                            label: "已检未结",
                            prop: "checked",
                            span: 5
                        }
                    ]
                },
                formTable: [
                    {
                        data: [{}],
                        option: {
                            page: false,
                            align: "center",
                            menu: false,
                            menuAlign: "center",
                            column: [
                                {
                                    label: "班次号",
                                    prop: "classID"
                                },
                                {
                                    label: "线路",
                                    prop: "road"
                                },
                                {
                                    label: "报班车辆",
                                    prop: "car"
                                },
                                {
                                    label: "时间",
                                    prop: "time"
                                },
                                {
                                    label: "检/售",
                                    prop: "sellOrBuy"
                                }
                            ]
                        }
                    }
                ],
                modalTitle: "",
                modalShow: false,
                printForm: {},
                printOption: {
                    column: [
                        {
                            label: "发车日期",
                            prop: "date",
                            type: "date",
                            span: 6
                        },
                        {
                            disabled:true,
                            label: "总座数",
                            prop: "all_seat",
                            span: 6
                        },
                        {
                            disabled:true,
                            label: "时间",
                            prop: "bus_time",
                            span: 6
                        },
                        {
                            label: "班次",
                            prop: "bus_id",
                            span: 6
                        },
                        {
                            disabled:true,
                            label: "线路",
                            prop: "line_name",
                            span: 6
                        },
                        {
                            disabled:true,
                            label: "售出",
                            prop: "sell_count1",
                            span: 6
                        },
                        {
                            disabled:true,
                            label: "免费儿童",
                            prop: "nobalanc_enfant_count",
                            span: 6
                        },
                        {
                            disabled:true,
                            label: "车牌号",
                            prop: "fact_vehi_no",
                            span: 6
                        },
                        {
                            disabled:true,
                            label: "卡位",
                            prop: "kawei",
                            span: 6
                        },
                        {
                            disabled:true,
                            label: "已检",
                            prop: "checked_count",
                            span: 6
                        },
                        {
                            disabled:true,
                            label: "未检",
                            prop: "unChecked",
                            span: 6
                        },
                        {
                            disabled:true,
                            label: "营运单位",
                            prop: "customer_name",
                            span: 10
                        }
                    ]
                },
                printTable: {
                    data: [],
                    option: {
                        page: false,
                        menu: false,
                        align: "center",
                        menuAlign: "center",
                        column: [
                            {
                                label: "到站",
                                prop: "stname"
                            },
                            {
                                label: "票型",
                                prop: "tks_type"
                            },
                            {
                                label: "票价",
                                prop: "price"
                            },
                            {
                                label: "里程",
                                prop: "kilo"
                            },
                            {
                                label: "人数",
                                prop: "checked_count"
                            },
                            {
                                label: "人公里",
                                prop: "owner_org"
                            },
                            {
                                label: "金额",
                                prop: "nobalance_checked_price_sum"
                            }
                        ]
                    }
                },
                sendClassForm: {},
                sendClassFormOption: {
                    column: [
                        {
                            label: "线路",
                            prop: "road",
                            span: 6
                        },
                        {
                            label: "班次号",
                            prop: "classID",
                            span: 6
                        },
                        {
                            label: "报班车",
                            prop: "car",
                            span: 5
                        }
                    ]
                },
                sendClassTable: {
                    data: [],
                    option: {
                        page: false,
                        align: "center",
                        menuAlign: "center",
                        menu: false,
                        column: [
                            {
                                label: "线路",
                                prop: "line_name"
                            },
                            {
                                label: "班次号",
                                prop: "bus_id"
                            },
                            {
                                label: "时间",
                                prop: "bus_time"
                            },
                            {
                                label: "状态",
                                prop: "status_id"
                            },
                            {
                                label: "计划车牌",
                                prop: ""
                            },
                            {
                                label: "报班车牌",
                                prop: "baoban_vehi_no"
                            },
                            {
                                label: "报班时间",
                                prop: "baoban_time"
                            },
                            {
                                label: "已售",
                                prop: "end_seat"
                            },
                            {
                                label: "余座",
                                prop: "begin_seat"
                            },
                            {
                                label: "检票口",
                                prop: "checkdoor"
                            }
                        ]
                    }
                },
                printChecForm: {},
                printChecFormOption: {
                    column: [
                        {
                            label: "发车日期",
                            type: "date",
                            prop: "date",
                            span: 8
                        }
                    ]
                },
                pPrintTable: {
                    // data: [],
                        page: false,
                        align: "center",
                        menu: false,
                        menuAlign: "center",
                        column: [
                            {
                                label: "单号",
                                prop: "no"
                            },
                            {
                                label: "班次日期",
                                prop: "bus_date"
                            },
                            {
                                label: "班次号",
                                prop: "bus_plan_id"
                            },
                            {
                                label: "发班时间",
                                prop: "create_time"
                            },
                            {
                                label: "检票人数",
                                prop: "all_seat"
                            },
                            {
                                label: "车牌号",
                                prop: "vehino"
                            },
                            {
                                label: "状态",
                                prop: "state"
                            },
                            {
                                label: "最后更新",
                                prop: "update_time"
                            }
                        ]
                },
                checkedForm: {},
                checkedOption: {
                    column: [
                        {
                            label: "车牌号码",
                            prop: "carID",
                            span: 22
                        },
                        {
                            label: "班次日期",
                            prop: "classDate",
                            span: 8
                        },
                        {
                            label: "班次号",
                            prop: "classNum",
                            span: 8
                        },
                        {
                            label: "时间",
                            prop: "time",
                            span: 8
                        },
                        {
                            label: "报班车牌",
                            prop: "carNo",
                            span: 8
                        },
                        {
                            label: "检票口",
                            prop: "checkDoor",
                            span: 8
                        },
                        {
                            label: "座号",
                            prop: "seatNo",
                            span: 8
                        },
                        {
                            label: "购票时间",
                            prop: "buyTime",
                            span: 8
                        },
                        {
                            label: "携童",
                            prop: "child",
                            span: 8
                        },
                        {
                            label: "携童名",
                            prop: "childName",
                            span: 8
                        },
                        {
                            label: "证件类型",
                            prop: "cardStyle",
                            span: 10
                        },
                        {
                            label: "证件号码",
                            prop: "cardNo",
                            span: 14
                        },
                        {
                            label: "姓名",
                            prop: "userName",
                            span: 10
                        },
                        {
                            label: "证件号码",
                            prop: "cardNo2",
                            span: 14
                        }
                    ]
                },
                checkedActive: "first",
                checkedID: {},
                checkedIdOption: {
                    dicData: DIC,
                    column: [
                        {
                            label: "证件类型",
                            type: "select",
                            prop: "cardStyle",
                            dicData: "credentialType",
                            span: 20
                        },
                        {
                            label: "证件号",
                            prop: "cardID",
                            span: 20
                        },
                        {
                            label: "性别",
                            prop: "cardID",
                            type: "select",
                            dicData: "SEX",
                            span: 12
                        },
                        {
                            label: "姓名",
                            prop: "name",
                            dicData: "SEX",
                            span: 12
                        }
                    ]
                },
                checkedOther: {},
                checkedOtherOption: {
                    dicData: DIC,
                    column: [
                        {
                            label: "身份证号",
                            prop: "id",
                            span: 22
                        },
                        {
                            label: "姓名",
                            prop: "name",
                            span: 22
                        },
                        {
                            label: "性别",
                            prop: "sex",
                            dicData: "SEX",
                            type: "select",
                            span: 12
                        },
                        {
                            label: "民族",
                            prop: "nation",
                            dicData: "MingZu",
                            type: "select",
                            span: 12
                        },
                        {
                            label: "出生",
                            prop: "born",
                            span: 22
                        }
                    ]
                },
                checkedDownTable: {
                    data: [],
                    option: {
                        page: false,
                        align: "center",
                        menu: false,
                        menuAlign: "center",
                        column: [
                            {
                                label: "车票号"
                            },
                            {
                                label: "日期"
                            },
                            {
                                label: "时间"
                            },
                            {
                                label: "到站"
                            },
                            {
                                label: "状态"
                            },
                            {
                                label: "票型"
                            }
                        ]
                    }
                }
            };
        },
        methods: {
            toPrint() {
                this.modalTitle = "班次发班";
                this.modalShow = true;
                this.getPrintTable();
            },
            toSendClass() {
                this.modalTitle = "班次报班";
                this.modalShow = true;
                this.getsendClassTable();
            },
            toCheck() {
                this.modalTitle = "个人打单记录";
                this.modalShow = true;
                this.getpPrintTable();
            },
            toNormalCheck() {
            },
            toSign() {
            },
            toAban() {
            },
            toAllAban() {
            },
            toTickCheck() {
                this.modalTitle = "票证核验";
                this.modalShow = true;
            },
            closeModual() {
                this.modalShow = false;
            },
            getPrintTable() {
                this.printTable.data = [];
                this.$http
                    .post("/sch/bus/plan/list")
                    .then(data => {
                        for (var item of data.data.list) {
                            this.printTable.data.push({
                                line_name: item.line_name,
                                type: item.type,
                                price: "",
                                owner_org: item.owner_org,
                                all_seat: item.all_seat,
                                kilo: "",
                                "ticket-price": ""
                            });
                        }
                    });
            },
            printTic() {
                /*this.$http
                    .post(
                        "/sch/bus/plan/doFaban?busdate=2018-08-24&busid=0009&ipo=1"
                    )
                    .then(data => {
                        if (data.data[0] == "0") {
                            this.$message({
                                message: "打单成功!",
                                type: "success"
                            });
                        } else {
                            this.$message.error(data.data[1]);
                        }
                    });*/
                if(this.printForm.date == ''){
                    this.$message.error('请选择日期');
                }else if(this.printForm.bus_id == '') {
                    this.$message.error('请填写班次');
                }else{
                    this.allDoBan('/sch/bus/plan/doFaban?busdate='+this.dateToString(this.printForm.date)+'&busid='+this.printForm.bus_id+'&ipo=1');
                }

            },
            unPrint() {
               /* this.$http
                    .post(
                        "/sch/bus/plan/doFaban?busdate=2018-09-07&busid=0003&ipo=1"
                    )
                    .then(data => {
                        if (data.data[0] == "0") {
                            this.$message({
                                message: "发班成功!",
                                type: "success"
                            });
                        } else {
                            this.$message.error(data.data[1]);
                        }
                    });*/
                if(this.printForm.date == ''){
                    this.$message.error('请选择日期');
                }else if(this.printForm.bus_id == '') {
                    this.$message.error('请填写班次');
                }else{
                    this.allDoBan('/sch/bus/plan/doFaban?busdate='+this.dateToString(this.printForm.date)+'&busid='+this.printForm.bus_id+'&ipo=1');
                }
            },
            getsendClassTable() {
                this.sendClassTable.data = [];
                this.$http
                    .post("/sch/bus/plan/list")
                    .then(data => {
                        for (var item of data.data.list) {
                            this.sendClassTable.data.push({
                                line_name: item.line_name,
                                bus_id: item.bus_id,
                                bus_time: item.bus_time,
                                status_id: item.status_id,
                                baoban_vehi_no: item.baoban_vehi_no,
                                baoban_time: item.baoban_time,
                                end_seat: item.end_seat,
                                begin_seat: item.begin_seat,
                                checkdoor: item.checkdoor
                            });
                        }
                    });
            },
            sendClass() {
                // console.log(this.sendClassForm.classID);
                this.getRequest(
                        '/sch/bus/plan/doBaoban?bus_plan_id=1635686&bus_id='+this.sendClassForm.classID+'&vehino='+this.sendClassForm.car+''
                    )
                    .then(data => {
                        console.log(data);
                        if (data.data[0] == "0") {
                            this.$message({
                                message: data.data[1],
                                type: "success"
                            });
                        } else {
                            this.$message.error(data.data[1]);
                        }
                    });
            },
            reset() {
                this.getsendClassTable();
            },
            getpPrintTable() {
                this.pPrintTable.data = [];
                this.$http
                    .post("/sch/bus/plan/busbill/listPersonal")
                    .then(data => {
                        for (var item of data.data.list) {
                            this.pPrintTable.data.push({
                                no: item.no,
                                bus_date: item.bus_date,
                                bus_plan_id: item.bus_plan_id,
                                create_time: item.create_time,
                                all_seat: item.all_seat,
                                vehino: item.vehino,
                                state: "",
                                update_time: item.update_time
                            });
                        }
                    });
            },
            closeTicModual() {
                this.modalTitle = "";
                this.modalShow = false;
            },
            handleClick() {
            },
            rowChange(val) {
            },
            handleLoadClick(tab, event) {
                console.log(tab.index, event);
                if(tab.index === '0'){
                    this.loadT = true;
                    this.loadF = false;
                }else{
                    this.loadT = false;
                    this.loadF = true;
                }
            },
            loadIcon1(){//正在检票班次列表 -刷新

                let self = this;
                this.checkDate = self.checkForm.date;
                console.log(this.checkForm.date);
                if(this.checkDate === ''){
                    this.checkDate = self.dateToString(new Date);
                    console.log(this.checkDate);
                }else{
                    this.checkDate = this.dateToString(this.checkForm.date);
                }
                console.log(this.checkDate);
                // console.log(this.dateToString(this.checkForm.date));
                // this.allLoad('2018-09-18','3','#appendIng');//测试数据
                this.allLoad(this.checkDate,'3','#appendData');
            },
            loadIcon2(){//已发班班次列表-刷新
                this.allLoad(this.checkDate,'4','#appendHas');
                // this.allLoad('2018-09-18','4','#appendHas');//测试数据
            },
            allLoad(v1,v2,v3){
                this.postRequest('/tks/check/buslist',{
                    'cds':'',
                    'bd': v1,
                    // 'bd': checkDate,
                    'bs': v2,
                    'order': 'asc'
                }).then(target =>{
                    console.log(target);
                    var tag = target.data;
                    $(v3).html(tag);
                    /*var res = $(".scrollDiv tr");
                    var result = $(".scrollDiv td");
                    for(var j=0;j<res.length;j++){
                        console.log(res[j]);
                        console.log($(res[j]));
                        console.log($(res[j])[0].innerText);
                        var resl = $(res[j])[0].innerText;
                        console.log(resl.split(''));
                        this.formTable[0].data = [];
                    this.formTable[0].data.push({
                          'classID':$(res[j])[0].innerText,
                          'road':$(res[j])[0].innerText,
                          'car':$(res[j])[0].innerText,
                          'time':$(res[j])[0].innerText,
                          'sellOrBuy':$(res[j])[0].innerText
                      });
                  }*/
                });
                $(v3).html = '';
            },
            selfBtn(){
                if(this.printChecForm.date == ''){
                    this.newDate = this.dateToString(new Date);
                }else{
                    this.newDate = this.dateToString(this.printChecForm.date);
                }
                this.allSelf(this.newDate);
            },
            selfShua(){
                if(this.printChecForm.date == ''){
                    this.newDate = this.dateToString(new Date);
                }else{
                    this.newDate = this.dateToString(this.printChecForm.date);
                }
                this.allSelf(this.newDate);
            },

            allSelf(val){
                this.postRequest('/sch/bus/plan/busbill/listPersonal',{
                    filterRules:JSON.stringify([{"field":"bus_date","op":"eq","value":val}]),
                    'page': 1,
                    'rows': 10,
                    'sort': 'create_time',
                    'order': 'desc'
                }).then(target =>{
                    console.log(target);
                    this.pPrintData = [];
                    var tag = target.data.list;
                    if(tag.length !== 0){
                        this.pPrintData = tag;
                    }
                })
            },
            getNation(){
                //获取民族列表
                this.postRequest('/common/constant/getNation').then(target => {
                    for(var i=0;i<target.data.length;i++){
                        DIC.MingZu.push(target.data[i]);
                    }
                });
            },
            getCredentialType(){
                //获取证件列表
                this.postRequest('/common/constant/getCredentialType').then(target => {
                    for(var i=0;i<target.data.length;i++){
                        DIC.credentialType.push(target.data[i]);
                    }
                });
            },
            searchBtn(){
                if(this.printForm.date == ''){
                    this.$message.error('请选择日期');
                }else if(this.printForm.bus_id == '') {
                    this.$message.error('请填写班次');
                }else{
                    this.allDoBan('/sch/bus/plan/getbussum?busdate='+this.dateToString(this.printForm.date)+'&busid='+this.printForm.bus_id+'');
                }
            },
            allDoBan(val){
                this.getRequest(val)
                // this.getRequest('/sch/bus/plan/getbussum?busdate=2018-09-18&busid=0103')
                    .then(target =>{
                        console.log(target);
                        this.printForm= { };
                        var tag = target.data[1];
                        if(target.data[0] == '0'){
                            this.printForm = tag;
                            if(tag.st_sums.length !== 0){
                                this.printForm.sell_count1 = tag.st_sums[0].sell_count;
                                this.printForm.nobalanc_enfant_count = tag.st_sums[0].nobalanc_enfant_count;
                                this.printForm.checked_count = tag.st_sums[0].checked_count;
                                this.printForm.unChecked = this.printForm.sell_count1 - this.printForm.checked_count;
                            }

                            $(".img-text").text(tag.bus_status);
                            for(var i=0;i<tag.length;i++){
                                // $(".img-text").text(tag[i].bus_status);
                            }
                            if(tag.balance_bills[0].del_flag){
                                tag.balance_bills[0].del_flag = '已结算';
                            }else{
                                tag.balance_bills[0].del_flag = '未结算';
                            }
                            this.printNewArr = [
                                tag.balance_bills[0].no,
                                tag.balance_bills[0].balance_oper,
                                tag.balance_bills[0].create_time,
                                tag.balance_bills[0].people_count,
                                tag.balance_bills[0].enfant_count,
                                tag.balance_bills[0].ticket_price_sum,
                                tag.balance_bills[0].del_flag,
                            ]
                        }
                        if(target.data[0] == '-1'){
                            this.$message.error(target.data[1]);
                        }
                        if(tag.balance_bills.length !== 0){
                            this.hasSe = true;
                            $('.print-text').text('');//清空再append
                            for(var j=0;j<this.printNewArr.length;j++){
                                console.log(this.printNewArr[j]);
                                $('.print-text')[j].append(this.printNewArr[j]);
                            }

                        }else if(tag.balance_bills.length == 0 && tag.st_sums.length !== 0){
                            this.hasSe = false;
                            this.noSeal = true;
                            this.printTable.data = tag.st_sums;
                            // console.log(this.printTable.data );
                            this.printTable.data[0].owner_org = (tag.st_sums[0].kilo)*(tag.st_sums[0].sell_count);
                            // console.log(this.printTable.data);
                        }else{
                            this.hasSe = false;
                            this.noSeal = true;
                            this.printTable.data = ['班次['+this.printTables.bus_id+']未有售票记录'];
                        }
                    })
            },
            getArr(){
                var tag = DIC.printArr;

                for(var i = 0;i<tag.length;i++){
                    console.log(tag[i]);
                    var str = '\
                        <li class="print-txt1">\
                            <span class="print-txt">'+tag[i]+'</span>\
                            <span class="print-text"></span>\
                        </li>';
                    $('.print-box').append(str);
                }
                $(".print-box li").css({
                    'float':'left',
                    'height':'28px',
                    'line-height':'28px',
                    'box-sizing':'border-box',
                    'margin-right':'15px',
                    'width':'245px',
                    'color':'#464C5B',
                });
                $(".print-box li")
            },
        },
        computed: {},
        components: {FormData, TableData},
        watch: {
            date(){
                console.log(11);
            }
        },
        mounted() {
            // this.searchBtn();
            this.getArr();
            this.getNation();
            this.getCredentialType();
            this.$emit("sendTag", 3);
        }
    };
</script>
<style scoped src="../../assets/css/acount/account.css">
</style>